﻿using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MyTodo.Views;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainView : Window
{
    public MainView()
    {
        InitializeComponent();

        btnMin.Click += (s, e) => WindowState = WindowState.Minimized;
        btnMax.Click += (s, e) =>
        {
            if (WindowState == WindowState.Normal)
                WindowState = WindowState.Maximized;
            else if (WindowState == WindowState.Maximized)
                WindowState = WindowState.Normal;
        };
        btnClose.Click += (s, e) => Close();
        StateChanged += (s, e) =>
        {
            if (WindowState == WindowState.Normal)
            {
                ((PackIcon)btnMax.Content).Kind = PackIconKind.WindowMaximize;
                btnMax.ToolTip = "窗口最大化";
            }
            else if (WindowState == WindowState.Maximized)
            {
                ((PackIcon)btnMax.Content).Kind = PackIconKind.WindowRestore;
                btnMax.ToolTip = "窗口复原";
            }
        };
        menuBar.SelectionChanged += (s, e) => drawerHost.IsLeftDrawerOpen = false;
    }
}
